package com.xyazm.product.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xyazm.common.dao.BaseDAO;
import com.xyazm.product.domain.entity.ProductSkuDO;
import com.xyazm.product.mapper.ProductSkuMapper;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 商品sku
 * @author xuyou
 * @date 2022年05月15日 21:42
 */
@Repository
public class ProductSkuDAO extends BaseDAO<ProductSkuMapper, ProductSkuDO> {

    public ProductSkuDO getProductSkuBySkuCode(String skuCode) {
        LambdaQueryWrapper<ProductSkuDO> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.eq(ProductSkuDO::getSkuCode, skuCode);
        return getOne(queryWrapper);
    }

    public List<ProductSkuDO> listProductSkusBySkuCode(List<String> skuCodeList) {
        LambdaQueryWrapper<ProductSkuDO> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.in(ProductSkuDO::getSkuCode,skuCodeList);
        return list(queryWrapper);
    }
}
